﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace msgtypebuilder
{
    public partial class HandlerBuilder : Form
    {
        public HandlerBuilder()
        {
            InitializeComponent();
        }

        public TreeNode MessageNode = null;

        private void generate_sender_Click(object sender, EventArgs e)
        {
            if (MessageNode != null)
            {
                MessageHandlerBuilder.GenerateSender(MessageNode, param_name.Text);
                MessageBox.Show("Generate Sender Success!");
            }
            else
                MessageBox.Show("Select a node first!");
        }

        private void generate_reciever_Click(object sender, EventArgs e)
        {
            if (MessageNode != null)
            {
                MessageHandlerBuilder.GenerateReciever(MessageNode);
                MessageBox.Show("Generate Reciever Success!");
            }
            else
                MessageBox.Show("Select a node first!");
        }

        private void HandlerBuilder_Load(object sender, EventArgs e)
        {
            if (MessageNode != null)
            {
                sender_msg.Text = MessageNode.Text;
                reciever_msg.Text = MessageNode.Text;
            }
        }
    }
}
